package com.blog.backend.gateWayController;

import com.blog.backend.req.TravelReq;
import com.blog.backend.resp.TravelResp;
import com.blog.backend.service.TravelManageService;
import com.blog.backend.utils.Result;
import com.blog.backend.vo.PageResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/travel")
public class DoorTravelController {

    @Resource
    private TravelManageService travelManageService;


    @PostMapping("/getDoorTravelList")
    public Result<PageResult<TravelResp>> getDoorTravelList(@RequestBody TravelReq req){
        req.setStatus(2);
        PageResult<TravelResp> pageResult = travelManageService.selectTravelList(req);
        return Result.success(pageResult);
    }

    @GetMapping("/getDoorTravelDetail")
    public Result<TravelResp> getDoorTravelDetail(@RequestParam String travelId){
        TravelResp resp = travelManageService.selectTravelDetail(travelId);
        return Result.success(resp);
    }

    @GetMapping("/getHotTravelList")
    public Result<List<TravelResp>> getHotTravelList(){
        List<TravelResp> list = travelManageService.getHotTravelList();
        return Result.success(list);
    }
}
